<!doctype html>
{php}
$static = '/static/home/';
{/php}
<html lang="en">
<head>
    <meta charset="utf-8" />
    <title>{$siteConfig['seo_title']}</title>
    <meta name="apple-mobile-web-app-title" content="{$siteConfig['seo_title']}">
    <meta name="viewport" content="initial-scale=1.0, minimum-scale=1.0,maximum-scale=1.0,user-scalable=no,width=device-width">
    <link rel="shortcut icon" href="{$static}images/favicon.ico">
    <link href="{$static}css/bootstrap.min.css" rel="stylesheet" type="text/css" />
    <link href="{$static}css/icons.min.css" rel="stylesheet" type="text/css" />
    <link href="{$static}css/app.min.css" rel="stylesheet" type="text/css" />
    <link href="{$static}css/style.css" rel="stylesheet" type="text/css" />
</head>
<body data-sidebar="dark">
<style type="text/css">
    table tr td {
        vertical-align:middle !important;
    }
</style>
<div id="layout-wrapper">
    {include file='public/mine_topbar' /}
    {include file='public/mine_left' /}
    <div class="main-content">
        <div class="page-content">
            <form action="{:url('urlChannelRelation/index')}">
            <div class="container-fluid">
                <!-- start page title -->
                <div class="row">
                    <div class="col-12">
                        <div class="page-title-box d-flex align-items-center justify-content-between">
                            <h4 class="mb-0 font-size-18"><i class="mdi mdi-file-multiple-outline"></i> 链接关联渠道</h4>
                            <div class="page-title-right">
                                <ol class="breadcrumb m-0">
                                    <li class="breadcrumb-item"><a href="javascript:void(0)">鹰眼短链</a></li>
                                    <li class="breadcrumb-item active">关联渠道</li>
                                </ol>
                            </div>
                        </div>
                    </div>
                </div>
                <!-- end page title -->

                <div class="row">
                    <div class="col-12">
                        <div class="card">
                            <div class="card-body">
                                <div class="row mb-3">
                                    <div class="col-xl-2 col-md-6">
                                        起始时间：<input type="text" class="form-control" id="startDate" name="startDate"
                                                    value="{$params['startDate']}" placeholder="请输入起始时间">
                                    </div>
                                    <div class="col-xl-2 col-md-6">
                                        结束时间：<input type="text" class="form-control" id="endDate" name="endDate"
                                                    value="{$params['endDate']}" placeholder="请输入结束时间">
                                    </div>
                                    <div class="col-xl-2 col-md-6">
                                        短链关键词：<input type="text" class="form-control" name="keyword"
                                                     value="{$params['keyword']}" placeholder="请输入关键词例如：a3A4bp">
                                    </div>
                                    <div class="col-xl-3 col-md-6">
                                        渠道名称：<input type="text" class="form-control" name="channelName"
                                                    value="{$params['channelName']}" placeholder="请输入渠道名称">
                                    </div>
                                    <div class="col-xl-1 col-md-6">　　　　
                                        <button type="submit" class="btn btn-primary btn-block">
                                            <i class="mdi mdi-file-search-outline"></i>
                                            <span class="title">搜索</span>
                                        </button>
                                    </div>
                                    <div class="col-xl-1 col-md-6">　　　　
                                        <a class="btn btn-danger btn-block" href="{:url('urlChannelRelation/index')}">
                                            <i class="mdi mdi-broom"></i>
                                            <span class="title">清空</span>
                                        </a>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div> <!-- end col -->
                </div> <!-- end row -->

                <div class="row">
                    <div class="col-12">
                        <div class="card">
                            <div class="card-body">
                                <div class="table-responsive">
                                    <table id="datatable" class="table table-bordered dt-responsive nowrap" style="border-collapse: collapse; border-spacing: 0; width: 100%;">
                                        <thead>
                                        <tr>
                                            <th>ID</th>
                                            <th>短链接</th>
                                            <th>原始链接</th>
                                            <th>渠道名称</th>
                                            <th>渠道参数key</th>
                                            <th>渠道参数值value</th>
                                            <th>创建时间</th>
                                            <th>操作</th>
                                        </tr>
                                        </thead>
                                        <tbody>
                                        {empty name="list"}
                                        <tr>
                                            <td>----</td>
                                            <td>----</td>
                                            <td>----</td>
                                            <td>----</td>
                                            <td>----</td>
                                            <td>----</td>
                                            <td>----</td>
                                            <td>----</td>
                                        </tr>
                                        {else /}
                                        {foreach name="list" item="vo"}
                                        <tr>
                                            <td>{$vo.ucr_id}</td>
                                            <td>{$shortUrl}/{$vo.keyword}</td>
                                            <td>{$vo.link}</td>
                                            <td>{$vo.uc_channel_name}</td>
                                            <td>{$vo.uc_channel_key}</td>
                                            <td>{$vo.uc_channel_code}</td>
                                            <td>{$vo.ucr_create_time}</td>
                                            <td>
                                                <a href="javascript:void(0)" class="btn btn-danger js-ajax-delete" data-id="{$vo.ucr_id}">删除</a>
                                            </td>
                                        </tr>
                                        {/foreach}
                                        {/empty}
                                        </tbody>
                                    </table>
                                </div>
                            </div>
                        </div>
                    </div> <!-- end col -->
                </div> <!-- end row -->

                {notempty name="pagination"}
                <div class="row">
                    <div class="col-12">
                        <div class="card">
                            <div class="card-body">
                                {:$pagination}
                            </div>
                        </div>
                    </div> <!-- end col -->
                </div> <!-- end row -->
                {/notempty}

            </div> <!-- container-fluid -->
            </form>
        </div>
        <!-- End Page-content -->
    </div>
    <!-- end main content-->

</div>
<!-- END layout-wrapper -->

<!-- JAVASCRIPT -->
<script src="{$static}libs/jquery/jquery.min.js"></script>
<script src="{$static}libs/bootstrap/js/bootstrap.bundle.min.js"></script>
<script src="{$static}libs/metismenu/metisMenu.min.js"></script>
<script src="{$static}libs/simplebar/simplebar.min.js"></script>
<script src="{$static}libs/node-waves/waves.min.js"></script>
<script src="{$static}libs/layer/layer.js"></script>

<script src="{$static}js/app.js"></script>
<script type="text/javascript">
    $('.js-ajax-delete').click(function () {
        var id = $(this).data('id');
        layer.confirm('您确认要删除当前短链关联的渠道吗？',
            {
                btn: ['确认', '取消'],
                title:'删除提示'
            },
            function () {
                $.ajax({
                    url: "{:url('urlChannelRelation/del')}",
                    type: "POST",
                    data: {id: id},
                    dataType: 'json',
                    async: false,
                    success: function (res) {
                        if (res.errorCode === 200) {
                            window.location.reload();
                        } else {
                            layer.alert(res.message, {
                                title: '提示',
                                icon: 2
                            });
                        }
                    }
                });
            }
        );
    });
</script>
</body>
</html>
